<?
include_once '../config/Config.php';
include '../models/Clases.php';
session_start();
//var_dump($_SESSION[ 'auser' ]);
//die();
$aUser = ( isset( $_SESSION[ 'auser' ] ) && !empty( $_SESSION[ 'auser' ] ) ) ? $_SESSION[ 'auser' ] : '0';
$sNombrePer=(isset($_SESSION['auser']->{Persona::COL_NOMBRE}))?$_SESSION['auser']->{Persona::COL_NOMBRE}:'';
$sMail=(isset($_SESSION['auser']->{Persona::COL_MAIL}))?$_SESSION['auser']->{Persona::COL_MAIL}:'';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

<!-- CSS Files-->
<link rel="stylesheet" type="text/css" href="css/custom-theme/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<link rel="stylesheet" type="text/css" href="css/table.css" />
<link rel="stylesheet" type="text/css" href="css/formation.css" />
<link rel="stylesheet" type="text/css" href="css/general.css" />
<link rel="stylesheet" type="text/css" href="css/treeview.css" />
<link rel="stylesheet" type="text/css" href="css/blockUI.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.alerts.css" />

<!-- JS Libs -->
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/jquery.layout-latest.js"></script>
<script type="text/javascript" src="js/formation.js"></script>
<script type="text/javascript" src="js/jquery.treeview.js"></script>
<script type="text/javascript" src="js/jquery.blockUI.js"></script>
<script type="text/javascript" src="js/jquery.simpletooltip.js"></script>
<script type="text/javascript" src="js/jquery.tools.min.js"></script>
<script type="text/javascript" src="js/jquery.formatCurrency-1.4.0.js"></script>
<script type="text/javascript" src="js/jquery.alerts.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker.js"></script>
<script>
	var myLayout; 
	var sNames = ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
	var sNaSh = ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'];
	var sDayName = ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'];
	var sDayNamesShort = ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'];
	var sDayNamesMin = ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'];
	
    $(document).ready(function () {

    	
        
        myLayout = $('body').layout({
            applyDefaultStyles: true,
            north__resizable: false,
            north__closable: false,
            south__resizable: false,
            south__closable: false,
            west__resizable: false,
            west__closable: false            
		});

        $("#sesionTooltip").simpletooltip({
    		customTooltip: function(target){
    			var strTooltip = '<div class="tooltipSesion">';
    			strTooltip+= 'Nombre: <?= $sNombrePer.'<br>'?>';
    			strTooltip+= 'Contacto: <?= $sMail.'<br>'?>';
    			strTooltip+= '<hr class="linea">';
    			strTooltip+= '<div class="tooltipLogout">';
    			strTooltip+= '<div onclick="cerrarSesion();">Cerrar Sesion</div>';
    			strTooltip+= '</div>';
    			strTooltip+= '</div>';
    			return strTooltip;
    		}
    	});        
       
    });

    function resetFormulario(idFormulario){
    	$('#'+idFormulario).each (function(){
    		this.reset();
		});
    };


    function cerrarSesion(){
    	location.href='procesador.php?controller=home&action=logout';
    };

    function addIconAfterSelect(oId,sIcon)
    {
    	$('#'+oId).after("<img id='img_"+oId+"' class='pointer' src='../public/imag/icons/"+sIcon+".png'>");
    }

    $('#loadmaskDiv').dialog({
        autoOpen: false,
        width: 300
    });

    $(document).ajaxStart($.blockUI)
    		   .ajaxStop($.unblockUI);
    
</script>
<title><?=Config::APP_NAME?> <?=Config::APP_FASE?></title>
</head>

<body>
	<?php  if($_REQUEST['controller']=='home' && $_REQUEST['action']=='inicio'){?>
		<div id="centerPanel"class="ui-layout-center"><? Config::switchs($_REQUEST);?></div>
	<?php  }
			else if($_REQUEST['controller']=='home' && $_REQUEST['action']=='dashboard'){?>
		<div id="headerPanel" class="ui-layout-north headerPanel">
			<div class="logoSernac">
			</div>
			<?=Config::APP_NAME?> <?=Config::APP_FASE?>
			<div class='sesionUsuario'>
				Bienvenido <b id='sesionTooltip'><?=$sNombrePer?>
				<img src="imag/icons/house.png"></img></b>
			</div>
		</div>
		<div id="menuPanel" class="ui-layout-west">
			<div class="header">Menu</div>
			<?Config::menu()?>			
		</div>
		<div id="centerPanel" class="ui-layout-center">
			<div id="dashboard" class="header">Dashboard</div>
			<div id="mainPanel" class="mainPanel">
				<? Config::switchs($_REQUEST);?>
			</div>
		</div>
		<div id="southPanel"class="ui-layout-south">
			<div class='version'>-</div>
			<div class='copyright'>-</div>
		</div>
    <?	   }
    	   else {
    	   		header('location:index.php?controller=home&action=inicio');
   		   }
    ?>
</body>

</html>